import Alert from './alert.vue';
import Vue from 'vue';

Alert.newInstance = properties =>{
    const props = properties || {};
    const Instance = new Vue({
        data:props,
        render(h) {
            return h(Alert,{
                props:props
            });
        }
    });

    // 挂载操作
    const component = Instance.$mount();
    document.body.appendChild(component.$el);


    // alert的组件实例
    const alert = Instance.$children[0];

    return {
        add(noticeProps) {
            alert.add(noticeProps);
            // console.log(noticeProps)
        },
        remove(name) {
            alert.remove(name)
        }
    }
};

export default Alert;